package com.gdth.bank.presenter;

import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

import com.gdth.bank.model.SyJybModel;
import com.gdth.bank.view.SyJyBView;

public class SyJybPresenter {
     private SyJybModel  mSyJybModel;
     private SyJyBView   mSyJyBView;
     public int loadDzCpKhXx = 101;
     public SyJybPresenter(SyJyBView mSyJyBView){
    	 this.mSyJyBView =mSyJyBView;
    	 mSyJybModel = new SyJybModel();
     }
     
   //etc 数据保存到本地后上传
 	public void saveTjSyJyb(String str){
 		mSyJyBView.showProgressDialog("提交中");
 		mSyJybModel.saveTjSyJyb(str)
 			.subscribeOn(Schedulers.io())
 			.unsubscribeOn(Schedulers.io())
 			.observeOn(AndroidSchedulers.mainThread())
 			.subscribe(new Subscriber<String>(){

 				@Override
 				public void onCompleted() {
 					// TODO Auto-generated method stub
 					mSyJyBView.hideProgressDialog();
 					mSyJyBView.showMessage("提交成功");
 				}

 				@Override
 				public void onError(Throwable arg0) {
 					// TODO Auto-generated method stub
 					mSyJyBView.showMessage("提交失败" + arg0.getMessage());
 					
 				}

 				@Override
 				public void onNext(String arg0) {
 					mSyJyBView.success();
 				}
 				
 			});
 	}
}
